package com.liu.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotBlank;

@Configuration
//@ConfigurationProperties(prefix = "sb")  //指定前缀 提供对应属性的get/set方法 实现属性的批量绑定
@Validated //启用验证注解
public class AppConfig {


    @Value("${db.username}")
    @NotBlank(message = "用户名不能为空")
    String username;
    @Value("${db.password}")
    String password;
    @Value("${db.port}")
    int port;



}
